//JScript File



/*function GetCookie( cookieName )
{
    var cookies = document.cookie.split( "; " );
    for( var i = 0; i < cookies.length; i++ )
    {
        var name = cookies[i].split( "=" );
        if ( cookieName == name[0] )
            return ( name[1] );
    }
    
    return null;
}

*/
function GetCookie(name)
{
    var result = null;
    var myCookie = document.cookie + ";";
    var searchName = name + "=";
    var startOfCookie = myCookie.indexOf(searchName);
    var endOfCookie;
    if (startOfCookie != -1)
    {
		startOfCookie += searchName.length;
		endOfCookie = myCookie.indexOf(";",startOfCookie);
		result = decodeURIComponent(myCookie.substring(startOfCookie, endOfCookie));
    }
    return result;
}

function readCookie()
{
    /*
    alert( GetCookie( "country" ) );
    var expires = new Date();
    
    SetCookie( "country", "usa", 60 );
    alert( GetCookie( "country" ) );
    */
}

function SetCookie( name, value )
{
    var expdate = new Date();
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    if ( expires != null )
        expdate.setTime( expdate.getTime() + ( expires * 1000 ) );
        
   document.cookie = name + "=" + encodeURIComponent(value) 
                    +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
                    +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
                    +((secure == true) ? "; secure" : "");
}

function DelCookie( name )
{
    var exp = new Date();
    exp.setTime( exp.getTime() - 1 );
    var cval = GetCookie( name );
    document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}
